import express from 'express';
import { getAudios, getAudio, uploadAudio, updateAudio, deleteAudio, upload } from '../controllers/audioController';
import { auth, checkRole } from '../middlewares/auth';

const router = express.Router();

// 获取所有音频
router.get('/', auth, getAudios);

// 获取单个音频
router.get('/:id', auth, getAudio);

// 上传音频
router.post('/', auth, checkRole(['admin']), upload.single('audio'), uploadAudio);

// 更新音频信息
router.put('/:id', auth, checkRole(['admin']), updateAudio);

// 删除音频
router.delete('/:id', auth, checkRole(['admin']), deleteAudio);

export default router; 